package zzzhc.image.recognize;

public abstract class AbstractFilter implements Filter {

	private static final long serialVersionUID = -8532425071163972272L;

	public void doFilter(RecognizeContext context) {
		int h = context.getHeight();
		int w = context.getWidth();
		for (int y = 0; y < h; y++) {
			for (int x = 0; x < w; x++) {
				context.setValue(x, y, filter(context, x, y, context
						.getValue(x, y)));
			}
		}
	}

	protected abstract int filter(RecognizeContext context, int x, int y, int p);
}
